package homework30;

public class ProxyAuthority extends AbstractAuthority{
    private RealAuthority realAuthority = new RealAuthority();
    private int level = 0;
    @Override
    public void modifyUserInfo() {
        if(level == 0){
            System.out.println("无法修改用户信息...");
        }else if (level == 1){
            realAuthority.modifyUserInfo();
        }
    }

    @Override
    public void viewNote() {
        System.out.println("浏览帖子...");
    }

    @Override
    public void publicNote() {
        if(level == 0){
            System.out.println("您没有该权限，无法修改...");
        }else if (level == 1) {
            realAuthority.publicNote();
        }
    }

    @Override
    public void modifyNote() {
        if(level == 0){
            System.out.println("您没有该权限，无法修改...");
        }else if(level ==1){
            realAuthority.modifyNote();
        }
    }

    @Override
    public void setLevel(int level) {
        this.level = level;
    }
}
